package com.peng.pay_thrift.main;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;

import com.peng.pay_thrift.meta.PayService;

public class PayClientMain {
	public static void main(String[] args) {
		System.out.println("【Pay】客户端启动....");
		TTransport transport = null;
		try {
			transport = new TSocket("localhost", 6666, 30000);
			TProtocol protocol = new TBinaryProtocol(transport);
			PayService.Client client = new PayService.Client(protocol);
			transport.open();
			// 测试
			System.out.println("============" + client.getOpenId("007") + "============");
		} catch (TTransportException e) {
			e.printStackTrace();
		} catch (TException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (null != transport) {
				transport.close();
			}
		}
	}
}
